package com.lzt.yijian.api;

import com.lzt.yijian.bean.Movie;
import com.lzt.yijian.bean.WeatherEntity;

import io.reactivex.Observable;
import io.reactivex.Observer;

public class ApiUtil extends Api {

    public static ApiUtil getInstance() {
        return SingletonHolder.INSTANCE;
    }

    private static class SingletonHolder {
        private static final ApiUtil INSTANCE = new ApiUtil();
    }

    /**
     * 用于获取豆瓣电影Top250的数据
     */
    public void getTopMovie(Observer<Movie> observer, int start, int count) {
        Observable<Movie> topMovie = apiService.getTopMovie(start, count);
        toSubscribe(topMovie, observer);
    }
    public void getMessage(Observer<WeatherEntity> observer, String city) {
        Observable<WeatherEntity> topMovie = apiService.getMessage(city);
        toSubscribe(topMovie, observer);
    }

}
